package com.hermes.biz.manager.item.impl;

import java.util.ArrayList;
import java.util.List;

import com.hermes.biz.common.model.item.ItemUserRelationDO;
import com.hermes.biz.common.model.result.UserCommentResultDO;
import com.hermes.biz.common.model.user.UserCommentDO;
import com.hermes.biz.dao.item.UserInterestedItemDAO;
import com.hermes.biz.dao.user.UserCommentDAO;
import com.hermes.biz.manager.item.UserItemRelationManager;
import com.hermes.biz.manager.user.UserCommentManager;

public class UserItemRelationManagerImpl implements UserItemRelationManager {

	private UserInterestedItemDAO userInterestedItemDAO;
	
	private UserCommentManager userCommentManager;
	
	public List<ItemUserRelationDO> getUserInterestedItems(long userId) {
		
		List<ItemUserRelationDO> resultList = this.userInterestedItemDAO.getUserInterestedItems(userId);
		return resultList;
	}

	public boolean insertUserInterestedItem(ItemUserRelationDO itemUserRelationDO) {

		boolean result = this.userInterestedItemDAO.insertUserInterestedItem(itemUserRelationDO);
		return result;
	}

	public boolean deleteUserInterestedItem(long userId, long itemId) {
		
		boolean result = this.userInterestedItemDAO.deleteUserInterestedItem(userId, itemId);
		return result;
	}

	public UserInterestedItemDAO getUserInterestedItemDAO() {
		return userInterestedItemDAO;
	}

	public void setUserInterestedItemDAO(UserInterestedItemDAO userInterestedItemDAO) {
		this.userInterestedItemDAO = userInterestedItemDAO;
	}

	public boolean hasUserInterestedItem(long userId, long itemId) {
		ItemUserRelationDO result = this.userInterestedItemDAO.getUserInterestedItem(userId,itemId);
		
		if(result!=null && result.getUserId()>0){
			return true;
		}
		
		return false;
	}

	public  List<UserCommentDO> getUserConcernItemCommentByItemId(long itemId) {
		 List<UserCommentDO> result = this.userCommentManager.getUserCommentInfoByItemId(itemId);
		 if(result==null){
			 return new ArrayList<UserCommentDO>();
		 }
		return result;
	}

	public UserCommentManager getUserCommentManager() {
		return userCommentManager;
	}

	public void setUserCommentManager(UserCommentManager userCommentManager) {
		this.userCommentManager = userCommentManager;
	}

}
